﻿<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>首页</title>
    <link rel="stylesheet" type="text/css" th:href="@{/bootstrap/css/bootstrap.min.css}"/>
    <script type="text/javascript" th:src="@{/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <style>
        label>span{
            margin-right: 20px;
        }
        div>label{
            font-size: 20px;
        }
    </style>
</head>
<body>
<div class="container-fluid" style="margin-top: 30px;">
    <div class="row">
        <div class="col-md-12">
            <label>
                Disruptor 信息 -->
                消费者线程数：<span th:text="${prop.consumerThreadNum}"></span>
                环形队列大小：<span th:text="${prop.bufferSize}"></span>
                生产者状态：<span th:if="${proStatus}">开启</span><span th:unless="${proStatus}">关闭</span>
            </label>
            <button class="btn btn-success" onclick="switchFun()">
                <b>trigger</b>
            </button>
        </div>
    </div>
    <br/>
    <br/>
    <div class="row">
        <div class="col-md-12">
            <button class="btn btn-success" onclick="testTx();">
                事务测试
            </button>
        </div>
    </div>
    <br/>
    <br/>
    <!--<div class="row">
        <div class="col-md-12">
            <button class="btn btn-success" onclick="window.location=ctx+'/akka/send?flag=1'">
                WORKING
            </button>&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn btn-success" onclick="window.location=ctx+'/akka/send?flag=2'">
                DONE
            </button>&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn btn-success" onclick="window.location=ctx+'/akka/send?flag=3'">
                CLOSE
            </button>
        </div>
    </div>-->
</div>
<script type="text/javascript" th:inline="javascript">
    var ctx = [[@{/}]];ctx = ctx.substr(0, ctx.length - 1);<!--获取项目根路径-->

    var proStatus = [[${proStatus}]];

    function switchFun(){
        var url = ctx;
        if (proStatus){
            url += "/stopProducer";
        }else {
            url += "/startProducer";
        }
        window.location = url;
    }

    function testTx(){
        $.ajax({
            url:ctx+"/tx/test",
            dataType:"text",
            async:false,
            success:function(data){
                alert(data);
            },
            error:function (XMLHttpRequest, textStatus, errorThrown){
                alert("系统异常，删除服务器配置失败！");
            }
        });
    }





</script>
</body>
</html>